import { defineStore } from 'pinia'

export const useThemeStore = defineStore('theme', {
  state: () => ({
    isLight: localStorage.getItem('theme') === 'light'
  }),
  actions: {
    toggleTheme() {
      this.isLight = !this.isLight
      localStorage.setItem('theme', this.isLight ? 'light' : 'dark')
    },
    setTheme(val) {
      this.isLight = val
      localStorage.setItem('theme', val ? 'light' : 'dark')
    }
  }
}) 